<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
function myAddEvent(obj, ev, fn)
{
	if(obj.attachEvent)
	{
		obj.attachEvent('on'+ev, fn);
	}
	else
	{
		obj.addEventListener(ev, fn, false);
	}
}

window.onload=function ()
{
	var oBtn=document.getElementById('btn1');
	
	myAddEvent(oBtn, 'click', function (){
		alert('a');
	});
	
	myAddEvent(oBtn, 'click', function (){
		alert('b');
	});
};
</script>
</head>

<body>
<input id="btn1" type="button" value="按钮" />
</body>
</html>
